function oRequest_APIEngine(engine) {
  this.engine = engine;
}

oRequest_APIEngine.prototype = {
  get: function (url, callback) {
    let o = this;
    this.engine.request.security.auth.get(url, function (auth_url) {
      o.engine.request.getAjax("GET", "json", auth_url, true, null, callback);
    });
  },
  post: function (url, data, callback) {
    let o = this;
    this.engine.request.security.auth.get(url, function (auth_url) {
      o.engine.request.getAjax("POST", "json", auth_url, true, data, callback);
    });
  },
  // post方式请求外部地址，后续考虑增加 type 区别 get 和 post
  open: function (url, data, callback) {
    this.engine.request.getAjax("POST", "json", url, true, data, callback);
  },
  upload: function (data, beforeCallback, completedCallback) {
    let o = this;
    this.engine.request.security.auth.get("/Octopus/Engine/Upload", function (auth_url) {
      o.engine.request.getUpload(auth_url, data, beforeCallback, completedCallback);
    });
  },
  export: function (source, callback) {
    // alert(JSON.stringify(data));
    let o = this;
    this.engine.request.security.auth.get("/Octopus/Engine/Export", function (auth_url) {
      o.engine.request.getExport(auth_url, source, callback);
    });
  },
  download: function (file, callback) {
    // alert(JSON.stringify(data));
    let o = this;
    this.engine.request.security.auth.get("/Octopus/Engine/Download", function (auth_url) {
      o.engine.request.getDownload(auth_url, file, callback);
    });
  },
};

export {
  oRequest_APIEngine
}


